package com.ruoyi.shop.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.shop.domain.GoodsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.shop.mapper.UserGoodsSpecialMapper;
import com.ruoyi.shop.domain.UserGoodsSpecial;
import com.ruoyi.shop.service.IUserGoodsSpecialService;

/**
 * 用户商品特价Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-08-13
 */
@Service
public class UserGoodsSpecialServiceImpl implements IUserGoodsSpecialService 
{
    @Autowired
    private UserGoodsSpecialMapper userGoodsSpecialMapper;

    /**
     * 查询用户商品特价
     * 
     * @param id 用户商品特价主键
     * @return 用户商品特价
     */
    @Override
    public UserGoodsSpecial selectUserGoodsSpecialById(Long id)
    {
        return userGoodsSpecialMapper.selectUserGoodsSpecialById(id);
    }

    /**
     * 查询用户商品特价列表
     * 
     * @param userGoodsSpecial 用户商品特价
     * @return 用户商品特价
     */
    @Override
    public List<UserGoodsSpecial> selectUserGoodsSpecialList(UserGoodsSpecial userGoodsSpecial)
    {
        return userGoodsSpecialMapper.selectUserGoodsSpecialList(userGoodsSpecial);
    }

    /**
     * 新增用户商品特价
     * 
     * @param userGoodsSpecial 用户商品特价
     * @return 结果
     */
    @Override
    public int insertUserGoodsSpecial(UserGoodsSpecial userGoodsSpecial)
    {
        userGoodsSpecial.setCreateTime(DateUtils.getNowDate());
        return userGoodsSpecialMapper.insertUserGoodsSpecial(userGoodsSpecial);
    }

    /**
     * 修改用户商品特价
     * 
     * @param userGoodsSpecial 用户商品特价
     * @return 结果
     */
    @Override
    public int updateUserGoodsSpecial(UserGoodsSpecial userGoodsSpecial)
    {
        userGoodsSpecial.setUpdateTime(DateUtils.getNowDate());
        return userGoodsSpecialMapper.updateUserGoodsSpecial(userGoodsSpecial);
    }

    /**
     * 批量删除用户商品特价
     * 
     * @param ids 需要删除的用户商品特价主键
     * @return 结果
     */
    @Override
    public int deleteUserGoodsSpecialByIds(Long[] ids)
    {
        return userGoodsSpecialMapper.deleteUserGoodsSpecialByIds(ids);
    }

    /**
     * 删除用户商品特价信息
     * 
     * @param id 用户商品特价主键
     * @return 结果
     */
    @Override
    public int deleteUserGoodsSpecialById(Long id)
    {
        return userGoodsSpecialMapper.deleteUserGoodsSpecialById(id);
    }
    @Override
    public List<GoodsVo> getGoodsByClassId(String classId)
    {
        return userGoodsSpecialMapper.getGoodsByClassId(classId);
    }


    @Override
    public List<GoodsVo> getGoodsByClassIdAndUserId(String classId, Long userId)
    {
        return userGoodsSpecialMapper.getGoodsByClassIdAndUserId(classId,userId);
    }
    @Override
    public List<GoodsVo> getGoodsBySearchAndUserId(String search, Long userId)
    {
        return userGoodsSpecialMapper.getGoodsBySearchAndUserId(search,userId);
    }
}
